<?php

namespace App\Console\Commands;

use App\Models\Ca\Customer;
use Illuminate\Console\Command;

class ExpiredCommand extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'command:expired';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '将客户加入公海';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return int
     */
    public function handle()
    {
        $date = date('Y-m-d');
        //标记客户过期
        Customer::query()
            ->where('yy_time', '<', $date)
            ->update(['status' => 4]);
    }
}